#include "RawInputBindings.h"

namespace TLAC::Input
{
RawInputCustomHidControllerBinding::RawInputCustomHidControllerBinding(RawInputCustomHidController::ButtonIndex button_index)
	: button_index_(static_cast<int>(button_index)),
	handler_(RawInput::GetInstance().hid_controller_handler_)
{}

bool RawInputCustomHidControllerBinding::IsDown()
{
	if (handler_.GetInputsAvailable().buttons[button_index_]) {
		return handler_.GetInputButtonsState()[button_index_];
	}
	return false;
}

bool RawInputCustomHidControllerBinding::IsTapped()
{
	if (handler_.GetInputsAvailable().buttons[button_index_]) {
		return handler_.GetInputButtonsTapped()[button_index_];
	}
	return false;
}

bool RawInputCustomHidControllerBinding::IsReleased()
{
	if (handler_.GetInputsAvailable().buttons[button_index_]) {
		return handler_.GetInputButtonsReleased()[button_index_];
	}
	return false;
}

}